package crp.core.academic.domain.repositories;

import crp.core.academic.domain.models.AcademicYearEntity;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import io.quarkus.panache.common.Sort;

import javax.enterprise.context.ApplicationScoped;
import java.util.stream.Stream;

@ApplicationScoped
public class AcademicYearRepository implements PanacheRepositoryBase<AcademicYearEntity, String> {
    public Stream<AcademicYearEntity> findOrderedAll() {
        return findAll(Sort.ascending("year"))
                .stream();
    }
}
